{{!-- 
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--}}
<h3 class="wrap-header bold"> Reports </h3>
<div class="wrap non-collapsible">
    {{#if setOldUi}}
    <h3 class="wrap-header search-header">Search Criteria
        <span class="badge badge-yellow pull-right" data-js="searchResult"></span>
    </h3>
    <div class="wrap well">
        <div class="form-horizontal">
            <div class="row ">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label col-sm-3 col-form-label">Policy Name</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="policyName" data-js="policyName" autofocus placeholder="Enter Policy Name">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label col-sm-3 col-form-label" for="policyType">Policy Type</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" data-id="policyType">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label col-sm-3 col-form-label" for="component">Component</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" data-id="component" name="componentType">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label col-sm-3 col-form-label">Resource</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="resourceName" data-js="resourceName" placeholder="Enter Resource Name">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="control-label col-sm-3 col-form-label" for="policyLabels">Policy Label</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" data-id="policyLabels" name="policyLabels">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group row">
                        <label class="control-label col-sm-3 col-form-label" for="zoneName">Zone Name</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" data-id="zoneName" name="zoneName">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group search-by">
                        <label class="control-label col-sm-3 col-form-label">Search By</label>
                        <div class="col-md-9" data-js="searchBy" style="width:100%">
                            <div class="input-group">
                                <div class="input-group-prepend" role="group">
                                    <button class="btn btn-secondary dropdown-toggle" data-id="btnUserGroup" data-toggle="dropdown">
                                        Group
                                    </button>
                                    <div class="dropdown-menu">
                                        <a data-id="grpSel" class="autoText dropdown-item" href="javascript:;">Group</a>
                                        <a data-id="userSel" class="autoText dropdown-item" href="javascript:;">Username</a>
                                        <a data-id="roleSel" class="autoText dropdown-item" href="javascript:;">Rolename</a>
                                    </div>
                                </div>
                                <input type="text" class="form-control" data-js="selectGroups">
                                <input type="text" class="form-control" style="display: none" data-js="userName">
                                <input type="text" class="form-control" style="display: none" data-js="roleName">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <div class="control-label col-sm-9 offset-md-3">
                            <button type="button" class="btn btn-primary btn-sm pull-left" data-js="searchBtn" name="searchPolicy">
                                <i class="fa-fw fa fa-search"></i> Search
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{/if}}
    <div class="row">
        <div class="col-md-12">
            <div class="btn-group dropleft btn-right" style="margin-top:10px;">
                <button type="button" data-name="downloadFormatBtn" class="btn btn-primary btn-sm dropdown-toggle" title="Export all below policies" data-toggle="dropdown">
                    <i class="fa-fw fa fa-external-link-square"></i> Export
                </button>
                <div class="dropdown-menu drop-font download-list">
                    <a data-id="xlsFormat" class="downloadFormat dropdown-item" href="javascript:void(0)">Excel file</a>
                    <div class="dropdown-divider"></div>
                    <a data-id="csvFormat" class="downloadFormat dropdown-item" href="javascript:void(0)">CSV file</a>
                    {{#showExportJson}}
                    <div class="dropdown-divider"></div>
                    <a data-id="jsonFormat" class="downloadFormat dropdown-item" href="javascript:void(0)">JSON file</a>
                    {{/showExportJson}}
                </div>
            </div>
        </div>
        <a href="javascript:void(0)" data-id="downloadReport"></a>
    </div>
    <div class="row report-table">
        <div class="col-md-12">
            {{#each policyHeaderList}}
            <h3 class="wrap-header bold search-header" data-js="hdfsHeader" data-compHeader="{{this.serviceDefName}}">
                {{capitaliseLetter this.serviceDefName}}
                <span class="badge badge-yellow btn-right" data-js="hdfsSearchResult"></span>
            </h3>
            <div class="wrap well position-relative" data-comp="{{this.serviceDefName}}">
                <div data-id="{{this.collName}}" class="hdfs-table showMoreLess"></div>
            </div>
            {{/each}}
        </div>
    </div>
</div>